package seatiger.tomcat.catalina;

import java.util.EventObject;

/**
 * 事件
 */
public class LifecycleEvent extends EventObject {
    /**
     * 和本次事件关联的数据
     */
    private Object data;

    /**
     * 在哪个生命周期类上触发的事件
     */
    private Lifecycle lifecycle;

    /**
     * 本次事件的类型
     */
    private String type;

    public LifecycleEvent(Lifecycle lifecycle,String type,Object data){
        super(lifecycle);
        this.lifecycle = lifecycle;
        this.type = type;
        this.data = data;
    }
    public LifecycleEvent(Lifecycle lifecycle,String type){
        this(lifecycle,type,null);
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

/*    public Lifecycle getLifecycle() {
        return lifecycle;
    }*/

    public <T> T getLifecycle() {
        return (T)lifecycle;
    }

    public void setLifecycle(Lifecycle lifecycle) {
        this.lifecycle = lifecycle;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
